using System;
using System.Data;
using System.Data.SqlTypes;
using System.Data.SqlClient;

namespace DataEntity
{
	public class T_Project_EarlyPlot : DBInteractionBase
	{
		#region Class Member Declarations
			private SqlInt32		_project_EarlyPlot_FirstC2, _project_EarlyPlot_FirstB2, _project_EarlyPlot_FirstD2, _project_EarlyPlot_Second2, _project_EarlyPlot_FirstE2, _project_EarlyPlot_FirstA2;
            private SqlDecimal      _project_EarlyPlot_Fees;
            private SqlString		_project_EarlyPlot_FirstD3, _project_EarlyPlot_FirstA1, _project_EarlyPlot_FirstE1, _project_EarlyPlot_Second3, _project_EarlyPlot_Second1, _project_EarlyPlot_FirstE3, _project_EarlyPlot_FirstB1, _project_EarlyPlot_FirstB3, _project_EarlyPlot_FirstA3, _project_EarlyPlot_FirstD1, _project_EarlyPlot_FirstC3, _project_EarlyPlot_FirstC1;
			private SqlGuid			_project_EarlyPlot_ID, _project_EarlyPlot_MainID;
		#endregion





		public override bool Delete()
		{
			SqlCommand	cmdToExecute = new SqlCommand();
			cmdToExecute.CommandText = "dbo.[sp_t_Project_EarlyPlot_Delete]";
			cmdToExecute.CommandType = CommandType.StoredProcedure;

			// Use base class' connection object
			cmdToExecute.Connection = _mainConnection;

			try
			{
				cmdToExecute.Parameters.Add(new SqlParameter("@guidProject_EarlyPlot_ID", SqlDbType.UniqueIdentifier, 16, ParameterDirection.Input, false, 0, 0, "", DataRowVersion.Proposed, _project_EarlyPlot_ID));

				if(_mainConnectionIsCreatedLocal)
				{
					// Open connection.
					_mainConnection.Open();
				}
				else
				{
					if(_mainConnectionProvider.IsTransactionPending)
					{
						cmdToExecute.Transaction = _mainConnectionProvider.CurrentTransaction;
					}
				}

				// Execute query.
				_rowsAffected = cmdToExecute.ExecuteNonQuery();
				return true;
			}
			catch(Exception ex)
			{
				// some error occured. Bubble it to caller and encapsulate Exception object
				throw new Exception("T_Project_EarlyPlot::Delete::Error occured.", ex);
			}
			finally
			{
				if(_mainConnectionIsCreatedLocal)
				{
					// Close connection.
					_mainConnection.Close();
				}
				cmdToExecute.Dispose();
			}
		}





		public override DataTable SelectAll()
		{
			SqlCommand	cmdToExecute = new SqlCommand();
			cmdToExecute.CommandText = "dbo.[sp_t_Project_EarlyPlot_SelectAll]";
			cmdToExecute.CommandType = CommandType.StoredProcedure;
			DataTable toReturn = new DataTable("t_Project_EarlyPlot");
			SqlDataAdapter adapter = new SqlDataAdapter(cmdToExecute);

			// Use base class' connection object
			cmdToExecute.Connection = _mainConnection;

			try
			{

				if(_mainConnectionIsCreatedLocal)
				{
					// Open connection.
					_mainConnection.Open();
				}
				else
				{
					if(_mainConnectionProvider.IsTransactionPending)
					{
						cmdToExecute.Transaction = _mainConnectionProvider.CurrentTransaction;
					}
				}

				// Execute query.
				adapter.Fill(toReturn);
				return toReturn;
			}
			catch(Exception ex)
			{
				// some error occured. Bubble it to caller and encapsulate Exception object
				throw new Exception("T_Project_EarlyPlot::SelectAll::Error occured.", ex);
			}
			finally
			{
				if(_mainConnectionIsCreatedLocal)
				{
					// Close connection.
					_mainConnection.Close();
				}
				cmdToExecute.Dispose();
				adapter.Dispose();
			}
		}


		#region Class Property Declarations
		public SqlGuid Project_EarlyPlot_ID
		{
			get
			{
				return _project_EarlyPlot_ID;
			}
			set
			{
				_project_EarlyPlot_ID = value;
			}
		}

        public SqlDecimal Project_EarlyPlot_Fees
        {
            get
            {
                return _project_EarlyPlot_Fees;
            }
            set
            {
                _project_EarlyPlot_Fees = value;
            }
        }


		public SqlGuid Project_EarlyPlot_MainID
		{
			get
			{
				return _project_EarlyPlot_MainID;
			}
			set
			{
				SqlGuid project_EarlyPlot_MainIDTmp = (SqlGuid)value;
				if(project_EarlyPlot_MainIDTmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_MainID", "Project_EarlyPlot_MainID can't be NULL");
				}
				_project_EarlyPlot_MainID = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstA1
		{
			get
			{
				return _project_EarlyPlot_FirstA1;
			}
			set
			{
				SqlString project_EarlyPlot_FirstA1Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstA1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstA1", "Project_EarlyPlot_FirstA1 can't be NULL");
				}
				_project_EarlyPlot_FirstA1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_FirstA2
		{
			get
			{
				return _project_EarlyPlot_FirstA2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_FirstA2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_FirstA2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstA2", "Project_EarlyPlot_FirstA2 can't be NULL");
				}
				_project_EarlyPlot_FirstA2 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstA3
		{
			get
			{
				return _project_EarlyPlot_FirstA3;
			}
			set
			{
				SqlString project_EarlyPlot_FirstA3Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstA3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstA3", "Project_EarlyPlot_FirstA3 can't be NULL");
				}
				_project_EarlyPlot_FirstA3 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstB1
		{
			get
			{
				return _project_EarlyPlot_FirstB1;
			}
			set
			{
				SqlString project_EarlyPlot_FirstB1Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstB1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstB1", "Project_EarlyPlot_FirstB1 can't be NULL");
				}
				_project_EarlyPlot_FirstB1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_FirstB2
		{
			get
			{
				return _project_EarlyPlot_FirstB2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_FirstB2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_FirstB2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstB2", "Project_EarlyPlot_FirstB2 can't be NULL");
				}
				_project_EarlyPlot_FirstB2 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstB3
		{
			get
			{
				return _project_EarlyPlot_FirstB3;
			}
			set
			{
				SqlString project_EarlyPlot_FirstB3Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstB3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstB3", "Project_EarlyPlot_FirstB3 can't be NULL");
				}
				_project_EarlyPlot_FirstB3 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstC1
		{
			get
			{
				return _project_EarlyPlot_FirstC1;
			}
			set
			{
				SqlString project_EarlyPlot_FirstC1Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstC1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstC1", "Project_EarlyPlot_FirstC1 can't be NULL");
				}
				_project_EarlyPlot_FirstC1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_FirstC2
		{
			get
			{
				return _project_EarlyPlot_FirstC2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_FirstC2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_FirstC2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstC2", "Project_EarlyPlot_FirstC2 can't be NULL");
				}
				_project_EarlyPlot_FirstC2 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstC3
		{
			get
			{
				return _project_EarlyPlot_FirstC3;
			}
			set
			{
				SqlString project_EarlyPlot_FirstC3Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstC3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstC3", "Project_EarlyPlot_FirstC3 can't be NULL");
				}
				_project_EarlyPlot_FirstC3 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstD1
		{
			get
			{
				return _project_EarlyPlot_FirstD1;
			}
			set
			{
				SqlString project_EarlyPlot_FirstD1Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstD1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstD1", "Project_EarlyPlot_FirstD1 can't be NULL");
				}
				_project_EarlyPlot_FirstD1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_FirstD2
		{
			get
			{
				return _project_EarlyPlot_FirstD2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_FirstD2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_FirstD2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstD2", "Project_EarlyPlot_FirstD2 can't be NULL");
				}
				_project_EarlyPlot_FirstD2 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstD3
		{
			get
			{
				return _project_EarlyPlot_FirstD3;
			}
			set
			{
				SqlString project_EarlyPlot_FirstD3Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstD3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstD3", "Project_EarlyPlot_FirstD3 can't be NULL");
				}
				_project_EarlyPlot_FirstD3 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstE1
		{
			get
			{
				return _project_EarlyPlot_FirstE1;
			}
			set
			{
				SqlString project_EarlyPlot_FirstE1Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstE1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstE1", "Project_EarlyPlot_FirstE1 can't be NULL");
				}
				_project_EarlyPlot_FirstE1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_FirstE2
		{
			get
			{
				return _project_EarlyPlot_FirstE2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_FirstE2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_FirstE2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstE2", "Project_EarlyPlot_FirstE2 can't be NULL");
				}
				_project_EarlyPlot_FirstE2 = value;
			}
		}


		public SqlString Project_EarlyPlot_FirstE3
		{
			get
			{
				return _project_EarlyPlot_FirstE3;
			}
			set
			{
				SqlString project_EarlyPlot_FirstE3Tmp = (SqlString)value;
				if(project_EarlyPlot_FirstE3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_FirstE3", "Project_EarlyPlot_FirstE3 can't be NULL");
				}
				_project_EarlyPlot_FirstE3 = value;
			}
		}


		public SqlString Project_EarlyPlot_Second1
		{
			get
			{
				return _project_EarlyPlot_Second1;
			}
			set
			{
				SqlString project_EarlyPlot_Second1Tmp = (SqlString)value;
				if(project_EarlyPlot_Second1Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_Second1", "Project_EarlyPlot_Second1 can't be NULL");
				}
				_project_EarlyPlot_Second1 = value;
			}
		}


		public SqlInt32 Project_EarlyPlot_Second2
		{
			get
			{
				return _project_EarlyPlot_Second2;
			}
			set
			{
				SqlInt32 project_EarlyPlot_Second2Tmp = (SqlInt32)value;
				if(project_EarlyPlot_Second2Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_Second2", "Project_EarlyPlot_Second2 can't be NULL");
				}
				_project_EarlyPlot_Second2 = value;
			}
		}


		public SqlString Project_EarlyPlot_Second3
		{
			get
			{
				return _project_EarlyPlot_Second3;
			}
			set
			{
				SqlString project_EarlyPlot_Second3Tmp = (SqlString)value;
				if(project_EarlyPlot_Second3Tmp.IsNull)
				{
					throw new ArgumentOutOfRangeException("Project_EarlyPlot_Second3", "Project_EarlyPlot_Second3 can't be NULL");
				}
				_project_EarlyPlot_Second3 = value;
			}
		}
		#endregion
	}
}
